<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <script>
        function AD(){
            var control = document.forms[0]['text'];
            var Direction = control.selectionDirection;
            alert(Direction);}
        </script>
        <form >
            <input type="text" name="text">
            <input type="button" value="点击我" onclick="AD()">

        </form>
    </body>
</html>